*&---------------------------------------------------------------------*
*& 包含               zfi005top
*&---------------------------------------------------------------------*

TYPE-POOLS: slis,icon,truxs.
TABLES: sscrfields.

*&---------------------------------------------------------------------&*
*&              alv parameter   *&
*&---------------------------------------------------------------------&*

DATA: g_repid     LIKE sy-repid,
      it_fieldcat TYPE lvc_t_fcat WITH HEADER LINE,
      is_layout   TYPE lvc_s_layo.

DATA: is_functxt TYPE smp_dyntxt.
DATA: it_raw  TYPE truxs_t_text_data.

*--------------------------------------------------------------------*
*&   导入字段
*--------------------------------------------------------------------*、、

DATA: BEGIN OF gs_record,
        headid TYPE char5, " 凭证序号
        bukrs  TYPE bukrs, " 公司代码 h COMP_CODE
        blart  TYPE blart, " 凭证类型 h DOC_TYPE
        bldat  TYPE bldat, " 凭证日期 h DOC_DATE
        budat  TYPE budat, " 过账日期 h PSTNG_DATE
        monat  TYPE monat, " 期间 h FIS_PERIOD  / FIS_PERIOD
        waers  TYPE waers , " 货币 09  WAERS
        xblnr  TYPE xblnr, " 参考凭证号 h  REF_DOC_NO
        numpg  TYPE j_1anopg, " 页数
        bktxt  TYPE bktxt, " 凭证抬头文本 h HEADER_TXT
        bschl  TYPE bschl, " 过账代码
        newko  TYPE bu_partner, " 屏幕科目   PART_ACCT
        umskz  TYPE umskz, " 特别总帐标识
        hkont  TYPE hkont, " 总账科目 1 GL_ACCOUNT
        wrbtr  TYPE wrbtr, " 凭证货币金额  09  AMT_DOCCUR
        dmbtr  TYPE dmbtr, " 按本位币计的金额
        mwskz  TYPE mwskz, " 税码，
        hwbas  TYPE hwbas, " 计税基础
        kostl  TYPE kostl, " 成本中心编号  1 COSTCENTER " ITEMNO_ACC
        aufnr  TYPE aufnr, " 订单号 09 / ORDERID
        matnr  TYPE matnr, " 物料 1 MATERIAL
        werks  TYPE werks_d, " 工厂 1 PLANT
        menge  TYPE menge_d, " 数量  1  QUANTITY
        meins  TYPE meins,  " 单位 1 BASE_UOM
        zfbdt  TYPE dzfbdt, " 基准日期
        zuonr  TYPE acpi_zuonr, " 分配
        sgtxt  TYPE sgtxt, " 项目文本 1  ITEM_TEXT
        rstgr  TYPE rstgr, " 原因代码
        xnegp  TYPE xnegp, " 反记账标识 h NEG_POSTNG
      END OF gs_record,
      gt_record LIKE TABLE OF gs_record.


DATA: BEGIN OF gs_out.
        INCLUDE STRUCTURE gs_record.
DATA: sel ,
        message TYPE bapi_msg,
        type,
        belnr   TYPE belnr_d,
      END OF gs_out,
      gt_out LIKE TABLE OF gs_out.


" bapi 数据
DATA: ls_header     TYPE bapiache09, "表头
      lt_amount     TYPE TABLE OF bapiaccr09, "货币项目
      ls_amount     TYPE          bapiaccr09,
      lt_return     TYPE TABLE OF bapiret2,  "返回参数
      ls_return     TYPE          bapiret2,
      lt_accountgl  TYPE TABLE OF bapiacgl09, "总账科目
      ls_accountgl  TYPE          bapiacgl09,
      lt_vendor     TYPE TABLE OF bapiacap09, "供应商科目
      ls_vendor     TYPE          bapiacap09,
      lt_customer   TYPE TABLE OF bapiacar09, "客户科目
      ls_customer   TYPE          bapiacar09,
      ls_accounttax TYPE          bapiactx09,
      lt_accounttax TYPE TABLE OF bapiactx09.
DATA lt_extension2 TYPE TABLE OF bapiparex.
DATA ls_extension2 TYPE          bapiparex.
DATA: lv_item TYPE i,
      lv_x .


DATA: ls_zexten TYPE  zbadi_acc.

DATA: lv_awtype TYPE  awtyp,
      lv_awkey  TYPE  awkey,
      lv_awsys  TYPE  awsys.